<div id="results">

<%#*<div style="margin:5px">sorted by: date, average exposure, duration, geo coverage%>

  <center style="font-size:12px"> <%= will_paginate @tracks  %>  </center>
  <br/>
  <ul style=" align:left;   overflow: auto;   list-style: none inside; ">
    <%
    #distance_of_time_in_words(t.start, t.end)
    @tracks.each_with_index {|t,i|
      if t.processed
      %>                                                      `
        <li style="background-color: rgb(235, 235, 235);padding-left:0px; margin-left:0px;margin-bottom:20px">
          <table  class="borderless" border="0" cellpadding="0" cellspacing="0" style="width: 100%;">
            <tbody>
              <tr>
                <td width="15"><img src="/images/roundedcornr_348668_tl.png" alt="Rounded Corner: Top-left" border="0" width="15" height="15"/></td>
                <td></td>
                <td width="15"><img src="/images/roundedcornr_348668_tr.png" alt="Rounded Corner: Top-right" border="0" width="15" height="15"/></td>
              </tr>
              <tr>
                <td></td>
                <td>
                  <div  class="header">
                    <div style="float:left">
                      <b><%=  t 'cartasur.users.show.starttime' %>: </b> <font style="font-size: 11px;" color="#777777"><%= t.starts_at %></font><br/>
                      <b><%= t 'cartasur.users.show.endtime' %>: </b> <span class="track-list-text"><%= t.ends_at %> (<%=distance_of_time_in_words(t.ends_at, Time.now) unless t.ends_at.nil? %> ago)</span> <br />
                      <% unless t.protocol.nil? %> <b><%= t 'cartasur.users.show.protocol' %>: </b> <span class="track-list-text"><a href="/cartasur/visiteds/<%= t.visited_for_track.try(:id) || 0 %>/summary"><%=friendly_objective_text t.protocol.objective.id %></a></span>  <% end %>
                    </div>
                    <div style="float:right">
                      <a href="/cartasur/users/<%=  @user.id %>/tracks/<%= t.id  %>.json"><img src="/images/icons/Download_16x16.png" align="absmiddle" alt="Download data"/>&nbsp;Data</a>
                      <%  if admin? %>
                        &nbsp;&nbsp;<%= link_to image_tag("/images/icons/delete_16x16.png", :align => "absmiddle") + " " +(t 'cartasur.forums.destroy'), cartasur_user_track_path(@user, t), :method => :delete  %>
                      <% end%>
                    </div>
                    <br/><br/><br/>
                  </div>

                  <div style="float:left">


                    <table align="left" width="400"><tr>
                        <td width="170px" valign="top"><b>Measurements: </b>
                          <font style="font-size: 11px;" color="#777777"> <br/>
                            <%= t 'cartasur.users.show.duration' %>: <% if t.try(:starts_at) %>
                                      <%=  distance_of_time_in_words(t.ends_at,t.starts_at)  %> <br/>
                                      <% else %>
                                        (unknown)
                                      <% end %>
                            <%= t 'cartasur.users.show.noofmeasurements' %>: <%= t.try(:count) %> <br/>
                            <%= t 'cartasur.users.show.average' %>: <%= '%.2f' % t.try(:avgloudness) %> dB(A)<br/>
                          </font>
                        </td>
                        <td valign="top"><img src="/cartasur/users/<%= @user.id%>/tracks/<%= t.id  %>.png?size=230x100"/></td>
                      </tr></table>
                  </div>
                  <div style="float:right;width:130px" >
                    <% if t.geolocated and not t.geom.nil? #nil check just to be sure
                      center=t.geom.envelope.centroid
                    %>
                      <img src="http://maps.google.com/staticmap?key=ABQIAAAAEDqSJ7sjOq1o3M9HFMUctBTP6FiD4Pq0_NOM64wEPpZs4eDxtRS5-gQAVDwr5RxsOtxOMbZGzM-pjQ&sensor=true&center=<%=center.lat%>,<%=center.lng%>&zoom=13&size=120x120" width="120"/><br/>
                      <a href="/cartasur/users/<%= @user.id %>/tracks/<%= t.id %>.kml"><img src="/images/icons/KML_16x16.png" align="absmiddle" alt="KML"/>&nbsp;<font size="2px" style="color:#999999">Map</font></a><br/>
                     <% if File.exists?("#{Rails.root}/cartasur/public/tours/tour#{t.id}.kml") %>
                      <a href="cartasur/tours/tour<%= t.id  %>.kml"><img src="/images/icons/KML_16x16.png" align="absmiddle" alt="KML"/>&nbsp;<font size="2px" style="color:#999999"><%= t 'cartasur.users.show.animatedmaps' %></font></a>
                    <% end
                    end %>
                  </div>

                </td><td></td></tr>
              <tr>
                <td><img src="/images/roundedcornr_348668_bl.png" alt="" border="0" width="15" height="15"/></td>
                <td></td>
                <td><img src="/images/roundedcornr_348668_br.png" alt="" border="0" width="15" height="15"/></td>
              </tr>
            </tbody></table>
        </li>

      <%  else %>
        <li >
          <table cellpadding="5" cellspacing="0" style="background-color: rgb(240, 240, 240); width:540px;padding:5px">
              <tr><td>
                <b><%= t 'cartasur.users.show.starttime' %>:</b><font style="font-size: 11px;" color="#777777"> <%= t.starts_at %> (<%=distance_of_time_in_words(t.starts_at, Time.now) unless t.starts_at.nil? %> ago) </font><br/>
                <p><center><b>
                    <%= t 'cartasur.users.show.tracknotprocessed' %></b>
                </center></p>
              </td></tr>
              </table>
          <hr style="background-color:#FFFFFF"/>
        </li>
      <%  end %>


    <% } %>
  </ul>
</div>